#include "widget.h"

#include <QProgressBar>
#include <QPushButton>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
    resize(600, 480);
    QProgressBar *pb = new QProgressBar(this);
    pb->move(100, 100);
    pb->resize(400, 50);

    pb->setRange(0, 1000000);
    pb->setValue(100000);
    //pb->setFormat("%v/%m");
    pb->setFormat("%p%");

    QPushButton *btn = new QPushButton("点击启动 进度条", this);
    btn->move(100, 200);
    btn->resize(200, 50);

    connect(btn, &QPushButton::clicked, [=]{
        for (int idx = 100000; idx <= 1000000; ++idx) {
            pb->setValue(idx);
        }
    });
}

Widget::~Widget()
{
}

